TryTake Method

Task Parallel System.Threading

Attempts to remove and return an object from the ConcurrentBag<(Of <(T>)>).

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Function TryTake ( _
	<OutAttribute> ByRef result As T _
) As Boolean
C#
public bool TryTake(
	out T result
)

Parameters

result
Type: T %
When this method returns, result contains the object removed from the ConcurrentBag<(Of <(T>)>) or the default value of T if the operation failed.

Return Value

true if an object was removed successfully; otherwise, false.

Implements

IProducerConsumerCollection<(Of <(T>)>)..::.TryTake(T%)

See Also